#include <iostream>
#include <vector>
#include <regex>
#include <algorithm>
#include <string>
using namespace std;

int x = 0, y = 0;

vector<string> split(string str, string pattern) {
	string::size_type pos;
	vector<string> result;
	str += pattern;
	int size = str.size();
	for (int i = 0; i < size; i++)

	{
		pos = str.find(pattern, i);
		if (pos < size) {
			string s = str.substr(i, pos - i);
			result.push_back(s);
			i = pos + pattern.size() - 1;
		}
	}
	return result;
}


vector<string> checkInvalid(vector<string>& target) {
	vector<string> res;
	regex e("^[AWSD][0-9]*$");
	sregex_iterator end;
	for (auto& str : target) {
		sregex_iterator pos(str.cbegin(), str.cend(), e);
		if (pos != end) {
			string movement = pos->str();
			res.push_back(movement);
		}
	}
	return res;
}

void move(vector<string> movements) {
	int hor = 0, ver = 0;
	for (auto& str : movements) {
		switch (str[0]) {
		case 'A':
			hor = stoi(str.substr(1));
			x -= hor;
			break;
		case 'W':
			ver = stoi(str.substr(1));
			y += ver;
			break;
		case 'S':
			ver = stoi(str.substr(1));
			y -= ver;
			break;
		case 'D':
			hor = stoi(str.substr(1));
			x += hor;
			break;
		}
	}
}

int main() {
	string str;
	getline(cin, str);
	vector<string> target = split(str, ";");
	vector<string> moves = checkInvalid(target);
	move(moves);
	cout << x << "," << y << endl;
	return 0;
}